package com.android.monee.data.access;

import com.android.monee.data.access.inMemory.BudgetDaoInMemory;
import com.android.monee.data.access.inMemory.MensualityDaoInMemory;
import com.android.monee.data.access.inMemory.ObservableBudgetDaoInMemory;
import com.android.monee.data.access.json.BudgetDaoJson;
import com.android.monee.data.access.json.MensualityDaoJson;

public class DaoFactory {

	public enum DaoTypes {
		INMEMORY, INMEMORY_OBSERVABLE, JSON
	};
	
	public static BudgetDao getBudgetDao(){
		return getBudgetDao(DaoTypes.JSON);
	}
	
	@SuppressWarnings("unchecked")
	public static BudgetDao getBudgetDao(DaoTypes daoType) {
		
		switch (daoType) {
		case INMEMORY:
			return BudgetDaoInMemory.getInstance();
		case INMEMORY_OBSERVABLE:
			return ObservableBudgetDaoInMemory.getInstance();
		case JSON:
			return BudgetDaoJson.getInstance();
		default:
			return null;
		}
	} 
	
	public static MensualityDao getMensualityDao(){
		return getMensualityDao(DaoTypes.JSON);
	}
	
	public static MensualityDao getMensualityDao(DaoTypes daoType){
		switch(daoType){
		case INMEMORY:
			return MensualityDaoInMemory.getInstance();
		case JSON:
			return MensualityDaoJson.getInstance();
		default:
			return null;
		}
	}
}
